import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Index from '@/views/index.vue';
import Content from '@/views/content.vue';
import ButtonsIcons from "@/views/buttons_icons.vue";
import DropDownBox from "@/views/drop_down_box.vue";
import Forms from "@/views/forms.vue";
import SelectionBox from "@/views/selection_box.vue";
import InputBox from "@/views/input_box.vue";
import Home from '@/views/home.vue';
import User from '@/views/user.vue';
import Login from '@/views/Login.vue';
import Layout from '@/layout/Layout.vue'; // 主应用布局
import RegisterComponent from '@/views/Register.vue';

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        redirect: '/login' // 默认跳转到登录页面
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '/register',
        component: RegisterComponent
    },
    {
        path: '/',
        component: Layout, // 主应用布局
        children: [
            {
                path: '/home',
                component: Home
            },
            {
                path: '/index',
                component: Index
            },
            {
                path: '/content',
                component: Content
            },
            {
                path: '/buttons_icons',
                component: ButtonsIcons
            },
            {
                path: '/drop_down_box',
                component: DropDownBox
            },
            {
                path: '/forms',
                component: Forms
            },
            {
                path: '/selection_box',
                component: SelectionBox
            },
            {
                path: '/input_box',
                component: InputBox
            },
            {
                path: '/user',
                component: User
            }
        ]
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes
});

export default router;
